package cn.edu.hit.core.message;

/**
 * 对随机的数据进行生成
 */
public final class DownDataAdapter extends UpDataAdapter {
    @Override
    public boolean accept(String type) {
        return "DownData".equalsIgnoreCase(type);
    }

    @Override
    protected double generateNextVal(double val, double avg, double A) {
        double r = random.nextDouble();
        double x = -1 / (1 + Math.exp(r)) * Math.signum(r - 0.2) * (A - avg + val);
        return val + x;
    }
}
